<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript演示</title>
</head>
<body>



<input type="button" onclick="on()" value="开灯">
<img id="myImage" border="0" src="../imgs/off.gif" style="text-align:center;">
<input type="button" onclick="off()" value="关灯">


<script>

    function on(){
        // 换on.gif图片

    }

    function off(){
        // 换off.gif图片

    }
    var x = 0;

    //定时器 每间隔1秒钟，偶数时开，奇数是时关

</script>

</body>
</html>